package com.maimao.model.goods;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author MaoLin Wang
 * @date 2020/11/28 12:02 上午
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableName("mm_spec_details")
public class SpecDetails implements Serializable {

    private static final long serialVersionUID = -4227499656407092613L;

    @TableId(type = IdType.AUTO, value = "id")
    private Integer id;

    @NotBlank(message = "请填写规格名")
    private String name;

    /**
     * 所属三级分类id
     */
    @NotNull(message = "请选择分类")
    @TableField("category_id")
    private Integer categoryId;

    @NotNull(message = "请填写排序")
    @TableField("`order`")
    private Integer order;

    @NotNull(message = "请选择规格组")
    @TableField("group_id")
    private Integer groupId;

    /**
     * 是否为数字类型
     */
    @NotNull(message = "请选择数字类型")
    private Boolean numberic;

    /**
     * 数字类型的单位
     */
    private String unit;

    /**
     * 是否为通用规格
     */
    @NotNull(message = "请选择通用性")
    private Integer common;

    /**
     * 是否可搜索
     */
    @NotNull(message = "请选择搜索性")
    private Integer searchable;

    /**
     * 搜索项,英文冒号分隔
     */
    @TableField("search_optional")
    private String searchOptional;

    /**
     * 表单类型『TEXT,NUMBER,SELECT,MULTI_SELECT』
     */
    @NotBlank(message = "请选择规表单类型")
    @TableField("form_type")
    private String formType;

    @Override
    public String toString() {
        return "SpecDetails{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", categoryId=" + categoryId +
                ", order=" + order +
                ", groupId=" + groupId +
                ", numberic=" + numberic +
                ", unit='" + unit + '\'' +
                ", common=" + common +
                ", searchable=" + searchable +
                ", searchOptional='" + searchOptional + '\'' +
                ", formType='" + formType + '\'' +
                '}';
    }
}
